
import 'package:flutter/material.dart';
import 'package:get/route_manager.dart';

class GCAppBar extends AppBar {
  GCAppBar({
    Key key,
    String titleText,
    List<Widget> actions,
    Function backTap,
    Color bgColor,
    bool whiteStyle = false
  }) : super(
    key: key,
    backgroundColor: whiteStyle ? Colors.white : Theme.of(Get.context).primaryColor,
    elevation: Theme.of(Get.context).appBarTheme.elevation,
    title: Text(titleText, style: whiteStyle ? TextStyle(color: Color(0xFF333333), fontSize: Theme.of(Get.context).appBarTheme.titleTextStyle.fontSize) : Theme.of(Get.context).appBarTheme.titleTextStyle),
    actions: actions,
    leading: GestureDetector(
        child: Icon(Icons.arrow_back_ios, color: whiteStyle ? Color(0xFF333333) : Colors.white), onTap: () {
          if(backTap == null) {
            Get.back();
          } else {
            backTap();
          }
    }),
  );
}